package jpush;

import cn.jiguang.common.ClientConfig;
import cn.jiguang.common.resp.APIConnectionException;
import cn.jiguang.common.resp.APIRequestException;
import cn.jpush.api.JPushClient;
import cn.jpush.api.push.PushResult;
import cn.jpush.api.push.model.PushPayload;
import com.jfinal.core.Controller;

public class Jpush extends Controller {
    public static void main(String[] args) {
        ce();
    }

    public static void ce() {
        JPushClient jPushClient = new JPushClient("f94c4adc625e9e90d58a4714", "9bd205464701bcc75707532b", null, ClientConfig.getInstance());
        PushPayload payload = bb();
        try {
            PushResult result = jPushClient.sendPush(payload);
        } catch (APIConnectionException e) {
            e.printStackTrace();
        } catch (APIRequestException e) {
            e.printStackTrace();
        }
    }

    public static PushPayload bb() {
        return PushPayload.alertAll("sss");

        /*return PushPayload.newBuilder().setPlatform(Platform.android())
                .setAudience(Audience.tag("tag1"))
                .setNotification(Notification.android("sss", "ss", null))
                .build();*/
    }


}
